﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace AdvanceLib.Core
{
    public class FileManager : Singleton<FileManager>
    {
        #region Methods
        public void Create(string fileName, string content)
        {
            using (StreamWriter writer = new StreamWriter(fileName))
            {
                writer.Write(content);
            }
        }
        public bool Exists(string fileName)
        {
            return File.Exists(fileName);
        }
        public void Delete(string fileName)
        {
            File.Delete(fileName);
        }
        public void Create(Dictionary<string, string> files)
        {
            foreach (KeyValuePair<string, string> pair in files)
            {
                this.Create(pair.Key, pair.Value);
            }
        }
        public bool Exists(IEnumerable<string> files)
        {
            foreach (string file in files)
            {
                if (!this.Exists(file)) return false;
            }
            return true;
        }
        public void Delete(IEnumerable<string> files)
        {
            foreach (string file in files)
            {
                this.Delete(file);
            }
        }
        #endregion
    }
}
